import 'package:fstudy/src/database/migration/versions.dart';
import 'package:sqflite_common/sqlite_api.dart';

class V2 implements AbsMigration {
  @override
  void migrate(Database db) {
    db.execute('ALTER TABLE dify_conversations RENAME TO messages');
    db.execute("""CREATE TABLE conversations (
    id TEXT PRIMARY KEY,
    name TEXT,
    created_at INTEGER,
    updated_at INTEGER
    )""");
  }

  @override
  void rollback(Database db) {
    db.execute('ALTER TABLE messages RENAME TO dify_conversations');
    db.execute('DROP TABLE conversations');
  }
}
